//
//  FCRegisteredViewController.swift
//  FinancialConsulting
//
//  Created by Max on 2017/11/1.
//  Copyright © 2017年 com.vector. All rights reserved.
//

import UIKit

class FCRegisteredViewController: FCViewController {

    @IBOutlet weak var phoneNumber: UITextField!
    
    @IBOutlet weak var passWord: UITextField!
    
    @IBOutlet weak var confirmPassword: UITextField!
    override func viewDidLoad() {
        super.viewDidLoad()

           self.title = "注册"
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    @IBAction func registeredActio(_ sender: Any) {
   
        if (phoneNumber.text?.characters.count)! > 10 {
            
            if (passWord.text?.characters.count)! > 5 {
                
                if passWord.text?.characters.count == confirmPassword.text?.characters.count {
                    
                    
                    let alert = UIAlertController.init(title: "注册成功！", message: nil, preferredStyle: .alert)
                    let alertCancelAction: UIAlertAction = UIAlertAction.init(title: "确定", style: .cancel, handler: { (UIAlertAction) in
                        
                        _ = self.navigationController?.popViewController(animated: true)
                        
                    })
                    alert.addAction(alertCancelAction)
                    self.present(alert, animated: true, completion: nil)

                    
                    
                }else {
                    
                    let alert = UIAlertController.init(title: "请完整填写注册信息", message: nil, preferredStyle: .alert)
                    let alertCancelAction: UIAlertAction = UIAlertAction.init(title: "确认", style: UIAlertActionStyle.cancel, handler: nil)
                    
                    alert.addAction(alertCancelAction)
                    self.present(alert, animated: true, completion: nil)
                }
            }
            
        }else {
            let alert = UIAlertController.init(title: "请完整填写注册信息", message: nil, preferredStyle: .alert)
            let alertCancelAction: UIAlertAction = UIAlertAction.init(title: "确认", style: UIAlertActionStyle.cancel, handler: nil)
            
            alert.addAction(alertCancelAction)
            self.present(alert, animated: true, completion: nil)
        }
        

    
    }

    @IBAction func haveNumber(_ sender: Any) {
   
      _ = self.navigationController?.popViewController(animated: true)
    }
    
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.view.endEditing(true)
    }
}
